package com.cykj.admin.controller;

import com.cykj.admin.annotation.MyLog;
import com.cykj.admin.service.IVipRuleService;
import com.cykj.admin.vo.VipRuleVO;
import com.cykj.common.dto.ResponseDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @BelongsProject: smart_recruit_backend
 * @BelongsPackage: com.cykj.admin.controller
 * @Author: 小小卢
 * @CreateTime: 2025-08-18 15:30
 * @Description: TODO
 * @Version: 1.0
 */
@Tag(name = "VipRuleController",description = "平台端vip规则的接口")
@RestController
@RequestMapping("vip")
public class VipRuleController {
    @Autowired
    private IVipRuleService vipRuleService;

    /**
     * @Description: 查询vip规则
     * @Param: []
     * @return: com.cykj.common.dto.ResponseDTO
     */
    @Operation(summary = "平台端查询vip规则接口")
    @GetMapping("rule")
    public ResponseDTO vipRuleList(VipRuleVO vipRuleVO){
        return vipRuleService.selectVipRuleList(vipRuleVO);
    }

    /**
    * @Description: 修改vip规则
    * @Param: [vipRuleVO]
    * @return: com.cykj.common.dto.ResponseDTO
    */
    @MyLog("修改vip规则")
    @Operation(summary = "平台端修改vip规则接口")
    @PostMapping("update")
    public ResponseDTO updateVipRule(@RequestBody VipRuleVO vipRuleVO){
        return vipRuleService.updateVipRule(vipRuleVO);
    }

    /**
    * @Description: 删除vip规则
    * @Param: [vipRuleVO]
    * @return: com.cykj.common.dto.ResponseDTO
    */
    @MyLog("删除vip规则")
    @Operation(summary = "平台端删除vip规则接口")
    @Parameters({
            @Parameter(name = "vipId",description = "会员Id",required = true,in = ParameterIn.PATH)
    })
    @DeleteMapping("delete/{vipId}")
    public ResponseDTO deleteVipRule(@PathVariable("vipId") Integer vipId){
        return vipRuleService.deleteVipRule(vipId);
    }

    /**
    * @Description: 新增vip规则
    * @Param: [vipRuleVO]
    * @return: com.cykj.common.dto.ResponseDTO
    */
    @MyLog("新增vip规则")
    @Operation(summary = "平台端新增vip规则接口")
    @PostMapping("add")
    public ResponseDTO addVipRule(@RequestBody VipRuleVO vipRuleVO){
        return vipRuleService.addVipRule(vipRuleVO);
    }
}